package com.lanou3g.hw0412;

import java.util.Scanner;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/10;
 * Otherwise, I don't know who created it either
 */
/*
完成 计算器v1.0
1. 可以计算两位整数的 + - * /
2. 使用流程:
    2.1 先输入1个数,再输入1个数
    2.2 然后输入操作符( + - * /)
    2.3 打印出结果
 */
public class Main {
    public static void main(String[] args) {
        float c = 0f / 0;
        System.out.println(c);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数");
        int a = scanner.nextInt();
        System.out.println("请输入第二个数:");
        int b = scanner.nextInt();
        System.out.println("请输入操作符:");
        String op = scanner.next();
//+
        Operator operator
                = OperatorFactory.getOperator(op);
        if (operator == null){
            System.out.println("操作符:" + op + "还不支持");

        }else {
            Number result = operator.compute(a, b);
            System.out.println("结果是: " + result);
        }



    }
}
